﻿
@{
    int min = (ViewBag.CurrentPage > 3) ? (ViewBag.CurrentPage - 3) : 1;
    int max = ((ViewBag.CurrentPage + 3) < ViewBag.MaxPage) ? ViewBag.CurrentPage + 3 : ViewBag.MaxPage;  
}
@if(ViewBag.MaxPage > 1){
    <ul class="pagination">
         @if(ViewBag.CurrentPage != 1){
                <li><a href="?page=1">&laquo;</a></li>
         }
    @for(int i = min; i <= max; i++){
        if(i != ViewBag.CurrentPage){   
            <li><a href="?page=@i">@i</a></li>
        }else{
             <li class="active"><a href="javascript:void(0)">@i</a></li>
        }
    }
        @if(ViewBag.CurrentPage != ViewBag.MaxPage){
            <li><a href="?page=@ViewBag.MaxPage">&raquo;</a></li>
        }
    </ul>
}
